package com.ssy.lingxi.purchase.api.enums.bidding;

import com.ssy.lingxi.common.language.LanguageHolder;

import java.util.Arrays;

/**
 *采购竞价外部流程记录枚举
 */
public enum BiddingExternalWorkStateEnum {
    CANCEL(-1, "已作废"),
    COMPLETE(99, "已完成"),
    STAY_SUBMIT_BIDDING(1, "待提交采购竞价单"),
    STAY_BIDDING_SINGNUP(2, "待竞价报名"),
//    STAY_CONFIRMATION_BIDDING_SINGNUP(3, "待审核竞价报名"),
//    NEXT_SIGN_UP(4, "竞价报名审核不通过"),
    STAY_BIDDING(5, "待竞价"),
    AUDIT_DETERMINE_BIDDING(6, "待确认竞价结果"),
    ;

    private Integer state;
    private String name;

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public String getName() {
        return LanguageHolder.getName(this.getClass(), this.state);
    }

    public void setName(String name) {
        this.name = name;
    }

    BiddingExternalWorkStateEnum(Integer state, String name) {
        this.state = state;
        this.name = name;
    }

    public static String getName(Integer state){
        BiddingExternalWorkStateEnum workEnum = Arrays.stream(BiddingExternalWorkStateEnum.values()).filter(v -> v.getState().equals(state)).findAny().orElse(null);
        return null == workEnum ? "" : LanguageHolder.getName(BiddingExternalWorkStateEnum.class, workEnum.getState());
    }
}
